Open
Conversation
jalvarado91
approved these changes
Oct 11, 2017
Collaborator
jalvarado91
left a comment
There was a problem hiding this comment.
Looks good. Small additions
| /// 2. Powerset set returns the set of all subsets of set | ||
| let rec powerset = function | ||
| | [] -> [[]] | ||
| | x::xs -> List.collect (fun subset -> [subset; x::subset]) (powerset xs) |
Collaborator
There was a problem hiding this comment.
Kill the indents
let rec powerset = function
| [] -> [[]]
| x::xs -> List.collect (fun subset -> [subset; x::subset]) (powerset xs)| /// 3. Transpose an m-by-n matrix | ||
| let rec transpose = function | ||
| | (_::_)::_ as M -> List.map List.head M :: transpose (List.map List.tail M) | ||
| | _ -> [] |
Collaborator
There was a problem hiding this comment.
Same here
let rec transpose = function
| (_::_)::_ as M -> List.map List.head M :: transpose (List.map List.tail M)
| _ -> []| Step Three: Each recursive call gets an input that is smaller than the original input | ||
|
|
||
| Clue something is wrong: The mergesort function is missing a case, which causes mergesort to be seen by | ||
| the compiler as 'a list -> 'b list instead of 'a list -> 'a list |
Collaborator
There was a problem hiding this comment.
... list instead of 'a list -> 'a list which tells us our merge sort is returning a list of items of a different type than given, which shouldn't be the case as we're simply sorting the elements.
shurt012
approved these changes
Oct 11, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.